/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.os.ejbs;

import edu.os.dao.zakharov.DAOFactory;
import edu.os.dao.zakharov.EnumDataSource;
import edu.os.dao.zakharov.interfacedao.RegistrationDAO;
import edu.os.dao.zakharov.interfacedao.UsersDAO;
import java.math.BigDecimal;
import java.rmi.RemoteException;
import javax.ejb.Singleton;
import javax.ejb.Stateless;

/**
 *
 * @author Zakharov
 */
//@Singleton
@Stateless
public class OnlineStoreBean implements OnlineStoreBeanLocal {
    
    // Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Business Method")
    
    
    @Override
    public void registerUser(String surname, String name, String patronymic,
            String email, String country, String city, String login, String password) throws RemoteException {

        DAOFactory dAOFactory = DAOFactory.getDAOFactory(EnumDataSource.ORACLE);
        RegistrationDAO registrationDAO = dAOFactory.getRegistrationDAO();
        UsersDAO usersDAO = dAOFactory.getUsersDAO();
        BigDecimal newReg = registrationDAO.addRegistration(surname, name, patronymic, email, country, city);
        BigDecimal newUser = usersDAO.addUser(login, password, newReg);

    }

    
    
}
